package com.es.www.kyl.controller.api;

import com.es.www.kyl.bean.R;
import com.es.www.kyl.bean.req.client.QuestionCompletionReq;
import com.es.www.kyl.bean.res.client.QuestionCompletionVO;
import com.es.www.kyl.bean.res.web.CategoryVO;
import com.es.www.kyl.service.CategoryService;
import com.es.www.kyl.service.QuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Estranger
 * @date 2025/8/13
 * description
 */
@Api(tags = "首页模块")
@RequiredArgsConstructor
@RestController
@RequestMapping("/client/homePage")
public class HomePageController {

	private final CategoryService categoryService;
	private final QuestionService questionService;

	@ApiOperation("查询一级分类列表")
	@PostMapping("/getTopCategoryList")
	public R<List<CategoryVO>> getTopCategoryList() {
		return R.successResponse(categoryService.getTopCategoryList());
	}

	@ApiOperation("查询做题情况")
	@PostMapping("/getQuestionCompletionList")
	public R<List<QuestionCompletionVO>> getQuestionCompletionList(@RequestBody QuestionCompletionReq req) {
		return R.successResponse(questionService.getQuestionCompletionList(req));
	}

}
